home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ WMP Clear Cache.xpl < prev    next >
Text File  |  2002-04-17  |  3KB  |  115 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 5.0"
  2. "TYPE"="5"
  3. "COUNT"="2"
  4. "UIPATH"="Internet\Windows Media Player"
  5. "NAME"="Clear Cache"
  6. "VERSION"="1.00"
  7. "WARNING"="1"
  8. "LANGUAGE"="VBScript"
  9. "TEXT 1"="Clear WMP Cache"
  10. "TEXT 2"="Clear WMP Cache (total erase!)"
  11. "DESCRIPTION 1"="This plug-in will totally erase the entire cache of Windows Media Player."
  12. "DESCRIPTION 2"="If you select to open the second option, the cache will be filled with garbage before deleting it, so it very hard to reproduce the contents of cache file."
  13. "DESCRIPTION 3"="IMPORTANT! Close Windows Media Player before using any of these functions!"
  14. "AUTHOR"="Xteq Systems"
  15. "CONTACTURL"="http://www.xteq.com"
  16. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  17. "COMMENT 1"="Setting found at Windows XP FAQ"
  18.  
  19.  
  20. sP="HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common AppData"
  21. sAdd="\Microsoft\Media Index\wmplibrary_v_0_12.db"
  22.  
  23. Sub Plugin_Initialize 
  24. End Sub
  25.  
  26. Sub Plugin_CheckData(ElementIndex)
  27. End Sub
  28.  
  29. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  30.  if ElementIndex=1 then 
  31.     Call DoWork(false)  
  32.  else
  33.     Call DoWork(true)
  34.  end if
  35.  
  36.  
  37.  
  38.  
  39. End Sub
  40.  
  41. Sub DoWork(EraseTotally)
  42.     s=RegReadValue(sP)
  43.     sFile=s & sAdd
  44.     
  45.     if fileexists(sFile) then
  46.         if EraseTotally then
  47.            lC=TxtOpen(sFile)
  48.  
  49.            'replace contents of file    
  50.            for l=1 to lC 
  51.                Call TxtSetLine(l,"-")
  52.            next
  53.          
  54.            'desktop.ini is special case..
  55.            if right(sFile,11)="desktop.ini" then
  56.               Call FileSetAttribute(sFile,"R-")
  57.               Call FileSetAttribute(sFile,"H-")
  58.               Call FileSetAttribute(sFile,"S-")
  59.            end if
  60.  
  61.           Call TxtSave()
  62.         end if
  63.  
  64.         'now kill the file
  65.         FileDelete(sFile)    
  66.  
  67.         Call MsgInformation("Cache has been cleared")
  68.      else
  69.        msgerror "Unable to locate WMP Cache - the file " & sFile & " can not be found."
  70.     end if
  71. end Sub
  72.  
  73.  
  74. Sub KillDir(DirName,EraseTotally,KillDirAlso)
  75.  iC=FileEnum(DirName & "*.*")
  76.  
  77.  for i=1 to iC 
  78.      sFile=FileEnumElement(i)
  79.      'index.dat can not be earased, always locked for writing... grr..
  80.      if lcase(right(sFile,9))<>"index.dat" then
  81.    
  82.         if EraseTotally then
  83.            lC=TxtOpen(sFile)
  84.  
  85.            'replace contents of file    
  86.            for l=1 to lC 
  87.                Call TxtSetLine(l,"-")
  88.            next
  89.          
  90.            'desktop.ini is special case..
  91.            if right(sFile,11)="desktop.ini" then
  92.               Call FileSetAttribute(sFile,"R-")
  93.               Call FileSetAttribute(sFile,"H-")
  94.               Call FileSetAttribute(sFile,"S-")
  95.            end if
  96.  
  97.           Call TxtSave()
  98.         end if
  99.  
  100.         'now kill the file
  101.         FileDelete(sFile)
  102.      end if               
  103.  
  104.  next 
  105.  
  106.  if KillDirAlso=true then
  107.     FolderDelete(DirName)
  108.  end if
  109. End Sub
  110.  
  111.  
  112. Sub Plugin_Terminate 
  113. End Sub
  114.  
  115.